const router = require('koa-router')()
const ws = require('../service/websocket');
const jwt = require('jsonwebtoken');

/**
 * @function /websocket/startWebSocket
 * @type GET
 * @returns { result } 
 */
router.get('/start', async(ctx) => {
  const res = await ws.startWebSocket();
  try {
    ctx.body = {
      status: res.status,
      msg: res.msg
    }
  } catch (e) {
    console.log('error: ', e)
    ctx.body = {
      code: 500,
      data: "WS start error, please contact with server"
    }
  }
})

module.exports = router